import { createRouter, createWebHistory } from 'vue-router'

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/login',
      name: 'login',
      component: () => import('../views/login/index.vue')
    },
    {
      path: '/',
      name: 'layout',
      component: () => import('../layout/index.vue'),
      redirect: '/dashboard',
      children: [
        {
          path: 'dashboard',
          name: 'dashboard',
          component: () => import('../views/dashboard/index.vue'),
          meta: { title: '仪表盘', icon: 'dashboard' }
        },
        {
          path: 'table',
          name: 'table',
          component: () => import('../views/table/index.vue'),
          meta: { title: '表管理', icon: 'table' }
        },
        {
          path: 'permission',
          name: 'permission',
          component: () => import('../views/permission/index.vue'),
          meta: { title: '权限管理', icon: 'lock' }
        },
        {
          path: 'audit',
          name: 'audit',
          component: () => import('../views/audit/index.vue'),
          meta: { title: '查询审计', icon: 'search' }
        }
      ]
    }
  ]
})

export default router